int x, y, depth;
gboolean native;
GdkEventMask event_mask;
+ GdkWindow *real_parent;
g_return_val_if_fail (attributes != NULL, NULL);
/* Windows with a foreign parent are treated as if they are children
* of the root window, except for actual creation.
*/
+ real_parent = parent;
if (GDK_WINDOW_TYPE (parent) == GDK_WINDOW_FOREIGN)
parent = gdk_screen_get_root_window (screen);
event_mask = GDK_EXPOSURE_MASK;
/* Create the impl */
- _gdk_window_impl_new (window, screen, visual, event_mask, attributes, attributes_mask);
+ _gdk_window_impl_new (window, real_parent, screen, visual, event_mask, attributes, attributes_mask);
}
else
{
GdkVisual *visual;
g_return_if_fail (GDK_IS_WINDOW (window));
- g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_ROOT);
- if (GDK_WINDOW_DESTROYED (window))
+ if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_ROOT ||
+ GDK_WINDOW_DESTROYED (window))
return;
private = (GdkWindowObject *) window;
visual = gdk_drawable_get_visual (window);
old_impl = private->impl;
- _gdk_window_impl_new (window, screen, visual, GDK_EXPOSURE_MASK, NULL, 0);
+ _gdk_window_impl_new (window, private->parent, screen, visual, GDK_EXPOSURE_MASK, NULL, 0);
new_impl = private->impl;
private->impl = old_impl;
private = (GdkWindowObject*) window;
if (private && GDK_WINDOW_DESTROYED (window))
return;
+
+ /* Filters are for the native events on the native window, so
+ ensure there is a native window. */
+ if (window)
+ gdk_window_set_has_native (window, TRUE);
if (private)
tmp_list = private->filters;
void
_gdk_window_impl_new (GdkWindow *window,
+ GdkWindow *real_parent,
GdkScreen *screen,
GdkVisual *visual,
GdkEventMask event_mask,
private = (GdkWindowObject *) window;
screen_x11 = GDK_SCREEN_X11 (screen);
- xparent = GDK_WINDOW_XID (private->parent);
+ xparent = GDK_WINDOW_XID (real_parent);
impl = g_object_new (_gdk_window_impl_get_type (), NULL);
private->impl = (GdkDrawable *)impl;